<template>
  <div class="Message">
    <div class="carouselcont">
      <div class="carouselleft">
        <template>
          <el-carousel height="20px" direction="vertical">
            <el-carousel-item v-for="(item,index) in companyname" :key="'companyname'+index">
              <p>
                <span>
                  {{item.xmname}}注册了简历
                </span>
                <!-- <span>
                {{item.name}}投递了{{item.companyname}}
              </span> -->
              </p>
            </el-carousel-item>
          </el-carousel>
        </template>
      </div>
      <div class="carouselconter">
        <template>
          <el-carousel height="20px" direction="vertical">
            <el-carousel-item v-for="(item,index) in companyname" :key="'companyname'+index">
              <p>
                <!-- <span>
                {{item.xmname}}注册了简历,
              </span> -->
                <span>
                  {{item.name}}投递了{{item.companyname}}
                </span>
              </p>
            </el-carousel-item>
          </el-carousel>
        </template>
      </div>
      <div class="carouselright">
        <template>
          <el-carousel height="20px" direction="vertical">
            <el-carousel-item v-for="(item,index) in companyname" :key="'companyname'+index">
              <p>
                <span>
                  {{item.zccompanyname}}注册了
                </span>
              </p>
            </el-carousel-item>
          </el-carousel>
        </template>
      </div>
      <!-- <div id="box">
        <div class="marquee">
          <span v-for='(item,index) in companyname' :key="'companyname'+index" style="margin-left:50px"> <span>
              {{item.xmname}}注册了简历,
            </span>
            <span>
              {{item.name}}投递了{{item.companyname}}
            </span></span>
        </div>
        <div class="marqueeT">
          <span v-for='(item,index) in companyname' :key="'companyname'+index" style="margin-left:50px"> <span>
              {{item.xmname}}注册了简历,
            </span>
            <span>
              {{item.name}}投递了{{item.companyname}}
            </span></span>
        </div>
      </div> -->

    </div>

    <div class="main">
      <el-card class="search-card">
        <ul class="ul1">
          <li>区域：</li>
          <el-radio-group v-model="radio1" @change="agreeChange">
            <el-radio-button label>不限</el-radio-button>
            <el-radio-button v-for="item in options.area" :value="item.code" :key="item.code" :label="item.code">
              {{item.name}}</el-radio-button>
            <el-radio-button label='666666' value="666666">其他地区</el-radio-button>
          </el-radio-group>
        </ul>
        <ul class="ul2">
          <li>行业：</li>
          <el-radio-group v-model="radio2" class="li2" @change="agreeChange2">
            <span @click="noTrade">
              <el-radio-button label>不限</el-radio-button>
            </span>
            <el-radio-button v-for="item in options.industry" :value="item" :key="item.code" :label="item">
              <span style="display:block;width:100%;height:100%" @click="aaaaa(item)">{{item.name}}</span>
            </el-radio-button>
          </el-radio-group>
        </ul>
        <div v-if="istrue" class="istrue">
          <el-radio-group v-model="radio4" class="nodisplay">
            <span @click="handletrade(item.code)" v-for="(item,index) in childrenArr" :key="index">
              <el-radio-button :key="index" :label="item.code">{{item.name}}</el-radio-button>
            </span>
          </el-radio-group>
        </div>
        <ul class="ul1">
          <li>月薪：</li>
          <el-radio-group v-model="radio3" @change="agreeChange">
            <el-radio-button label>不限</el-radio-button>
            <el-radio-button label="1">1K以下</el-radio-button>
            <el-radio-button label="2">1K-2K</el-radio-button>
            <el-radio-button label="3">2K-4K</el-radio-button>
            <el-radio-button label="4">4K-6K</el-radio-button>
            <el-radio-button label="5">6K-8K</el-radio-button>
            <el-radio-button label="6">8K-10K</el-radio-button>
            <el-radio-button label="7">10K-15K</el-radio-button>
            <el-radio-button label="8">15K-20K</el-radio-button>
            <el-radio-button label="9">20K-50K</el-radio-button>
            <el-radio-button label="10">50K以上</el-radio-button>
          </el-radio-group>
        </ul>
        <ul class="specialPosition">
          <li>特殊职位：</li>
          <el-radio-group v-model="isVeteran" @change="soldierChange">
            <el-radio-button label>不限</el-radio-button>
            <el-radio-button label='1' class="isVeteran">退役军人、军人家属招聘</el-radio-button>
          </el-radio-group>
        </ul>
        <ul class="ul1">
          <el-form :model="ruleForm" ref="ruleForm" class="demo-ruleForm" :inline="true">
            <el-form-item prop="region">
              <el-cascader :options="options.category" :props="{value:'code',label:'name',children:'childVo'}"
                :show-all-levels="false" v-model="ruleForm.region" placeholder="职位类别" @change="handlechange">
              </el-cascader>
            </el-form-item>
            <el-form-item prop="region2">
              <el-select v-model="ruleForm.region2" @change="handlechange2" placeholder="工作经验">
                <el-option v-for="item in options.work_exp" :label="item.name" :value="item.val" :key="item.val">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item prop="region3">
              <el-select v-model="ruleForm.region3" @change="handlechange2" placeholder="学历要求">
                <el-option v-for="item in options.education" :label="item.name" :value="item.val" :key="item.val">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item prop="region4">
              <el-select v-model="ruleForm.region4" @change="handlechange2" placeholder="公司性质">
                <el-option v-for="item in options.company_nature" :label="item.name" :value="item.val" :key="item.val">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item prop="region5">
              <el-select v-model="ruleForm.region5" @change="handlechange2" placeholder="职位性质">
                <el-option v-for="item in options.work_mode" :label="item.name" :value="item.val" :key="item.val">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item prop="region6">
              <el-select v-model="ruleForm.region6" @change="handlechange2" placeholder="职位标签">
                <el-option v-for="item in options.allure" :label="item.name" :value="item.val" :key="item.val">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-button @click="resetForm('ruleForm')">清空类别</el-button>
            </el-form-item>
          </el-form>
        </ul>
      </el-card>
      <div class="content">
        <div class="left">
          <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange" class="first"
            v-show="options.list.length > 0">
            全选
            <el-button plain type="primary" @click="allDeliverSaveDialog">一键申请</el-button>
            <el-button plain type="primary" @click="create_time">最新发布</el-button>
            <el-button plain type="primary" @click="max_wage">薪资最高</el-button>
          </el-checkbox>
          <el-checkbox-group v-model="checkedCities" @change="handleCheckedCitiesChange">
            <el-checkbox v-for="(city,index) in options.list" :label="city" :key="index">
              <div class="jobList">
                <div style="width:80%; display:flex;flex-direction: column;justify-content: space-between;">
                  <div class="jobList">
                    <span @click="handleclick(city)">{{city.name}}
                      <span class="cityrefreshTime">{{city.refreshTime | timedate}}</span>
                    </span>

                    <span @click="enterBusinessDetail(city)">{{city.companyInfo ? city.companyInfo.name : ''}}</span>
                  </div>
                  <div class="jobList positionItem">
                    <p>
                      <span class="salary">{{city.wageText}}</span>
                      <span>{{city.workAreaText?city.workAreaText:'地区不限'}}&nbsp;|</span>
                      <span>{{city.workExpText?city.workExpText:'经验不限'}}&nbsp;|</span>
                      <span>{{city.educationText?city.educationText:'学历不限'}}&nbsp;|</span>
                      <span>{{city.ageText}}&nbsp;|</span>
                      <span>{{city.recruitNum ? '招聘'+city.recruitNum + '人' : '暂无招聘人数'}}</span>
                    </p>
                    <p>
                      <span>{{city.companyInfo&&city.companyInfo.natureText?city.companyInfo.natureText:'暂无'}}&nbsp;|&nbsp;{{city.companyInfo&&city.companyInfo.scaleText?city.companyInfo.scaleText:'暂无'}}</span>
                    </p>

                  </div>
                </div>
                <div style="margin-right:20px;">
                  <el-avatar shape="square"
                    :src="(city.companyInfo && city.companyInfo.logo)||require('../../../assets/img/qiye.png')">
                  </el-avatar>
                </div>
              </div>
              <div class="jobList mt10">
                <div>
                  <el-tag effect="plain" type="info" v-if="city.allureText"
                    v-for="(tag,index) in city.allureText.split(',').slice(0, 4)" :key="index"
                    style="margin-right:5px;">{{tag}}
                  </el-tag>
                </div>
                <div class="favorite">
                  <div class="oneApply">
                    <span class="collection" ref="collectDom" @click="getCollection(city)" v-if="!city.favorite">
                      <img src="../../../assets/img/shoucang.png" alt /> &nbsp;收藏
                    </span>
                    <span class="collection active" ref="collectDom" @click="cancelCollection(city)"
                      v-if="city.favorite">
                      <img src="../../../assets/img/quxiaoshoucang.png" alt /> &nbsp;已收藏
                    </span>
                    <el-button type="primary" class="oneApply-btn" @click="oneDeliverSaveDialog(city)">一键申请
                    </el-button>
                  </div>
                </div>
              </div>
            </el-checkbox>
          </el-checkbox-group>
          <el-row class="noData mt10" v-show="options.list.length<=0">
            暂无数据
          </el-row>
          <div class="pagination">
            <el-pagination background layout="prev, pager, next" :total="total" :current-page="currentPage"
              @current-change="current_change"></el-pagination>
          </div>
        </div>
        <div class="right">
          <Login></Login>
          <!-- <div style="width:100%;margin-top:20px;display:flex;justify-content: space-around;">
                        <el-avatar  :src="squareUrl"></el-avatar>
                        <div style="display:flex;flex-direction: column;justify-content:center;">
                            <span>Hi,Black</span>
                            <span>欢迎回来，上午好</span>
                        </div>
                    </div>
                    <ul style="list-style:none;display:flex;justify-content:space-around;margin-top:35px;">
                        <li style="display:flex;flex-direction:column;justify-content:space-around;align-items: center;">
                            <span style="font-size:50px;color:#00D3C3">99+</span>
                            <span>企业看过</span>
                        </li>
                        <li style="display:flex;flex-direction:column;justify-content:space-around;align-items: center;">
                            <span style="font-size:50px;color:#FCA418">99+</span>
                            <span>企业反馈</span>
                        </li>
                    </ul>
                    <ul style="list-style:none;display:flex;justify-content:space-around;margin-top:50px;">
                        <li style="display:flex;flex-direction:column;justify-content:space-around;align-items: center;height:100px">
                            <img src="../../../assets/images/jianli.png" alt="">
                            <span>我的简历</span>
                        </li>
                        <li style="display:flex;flex-direction:column;justify-content:space-around;align-items: center;">
                            <img src="../../../assets/images/jianlishuaxin.png" alt="">
                            <span>刷新简历</span>
                        </li>
                    </ul>-->
        </div>
      </div>
    </div>
    <!-- 选择 简历弹框 -->
    <el-dialog width="30%" class="elDialog" height="20px" :visible.sync="innerVisible" :append-to-body="false"
      @close="closeResume">
      <div slot="title" class="selectResumeHeader">
        <span>请选择投递的简历</span>
      </div>
      <el-col :span="24">
        <div style="height:100px;">
          <el-select v-model="resumeValue" placeholder="请选择" popper-class="popper-class" @change="changeResume">
            <el-option v-for="item in resumelist" :key="item.id" :label="item.title" :value="item.id"></el-option>
          </el-select>
          <div class="checkouts">
            <el-checkbox v-model="resumeChecked">将该份简历设置为快速投递(推荐)</el-checkbox>
          </div>
        </div>
      </el-col>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="deliverSave_determine" v-if="!isAll">立即投递</el-button>
        <el-button type="primary" @click="allDeliverSave" v-else>立即投递</el-button>
      </div>
    </el-dialog>
    <!-- feat:该岗位为樟树市人才服务代招职位，如需投递请联系招聘负责人。 -->
    <div class="jonDz">
      <el-dialog class="elDialog" :visible.sync="isJobType" width="30%" style="margin-top:15vh"
        :before-close="closeResume">
        <p slot="title" class="selectResumeHeader">
          <span>申请职位</span>
        </p>
        <p class="jobItem">该岗位为樟树市人才服务代招职位，如需投递请联系招聘负责人。</p>
        <p class="jobItem">联系人：{{companyInfo.contact || '暂无'}}</p>
        <p class="jobItem">联系电话：{{companyInfo.phone || '暂无'}}</p>
        <p class="jobItem">座机：{{companyInfo.tel || '暂无'}}</p>
        <p class="jobItem">联系邮箱：{{companyInfo.mail || '暂无'}}</p>
        <span slot="footer" class="dialog-footer">
          <el-button type="primary" @click="closeResume">确 定</el-button>
        </span>
      </el-dialog>
    </div>
  </div>
</template>
<script>
import { list, industry, parentArea, dictName, category, Collection, deliverSave, gitInterface, updateExpress, cancelCollection } from '../../../api/index.js';

export default {
  name: 'baseform',
  data () {
    return {
      // 是都全部申请
      isAll: false,
      // 简历列表
      resumelist: [],
      //  选中简历
      resumeValue: '',
      // 简历id
      resumeId: '',

      // 将该份简历设置为快速投递
      resumeChecked: false,
      // 简历弹框 隐藏显示 开关
      outerVisible: false,
      innerVisible: false,
      isCurrent: -1,
      childrenArr: [],
      radio1: '',
      radio2: '',
      radio3: '',
      radio4: '',
      // 特殊职位
      isVeteran: '',
      allureText: '',
      get: '',
      column: 'refresh_time',
      str: '',
      istrue: false,
      total: 0,
      currentPage: 1,
      isIndeterminate: false,
      checkAll: false,
      checkedCities: [],
      userId: '',
      jobId: '',
      companyId: '',
      squareUrl: 'https://cube.elemecdn.com/9/c2/f0ee8a3c7c9638a54940382568c9dpng.png',
      options: {
        list: [],
        industry: [],
        area: JSON.parse(localStorage.getItem("parentAreas")) || [],
        category: [],
        work_exp: [],
        education: [],
        company_nature: [],
        allure: [],
        work_mode: [],
      },
      ruleForm: {
        region: '',
        region2: '',
        region3: '',
        region4: '',
        region5: '',
        region6: ''
      },
      animate: false,
      companyname: [
        {
          xmname: "李智",
          name: '黄五平',
          companyname: "湖南海鸥环保科技有限公司",
          zccompanyname: "湖南阁尹汽车销售服务有限公司",
        },
        {
          xmname: "苏炼",
          name: '谭玉美',
          companyname: "乐动乐体育有限公司",
          zccompanyname: "南方普惠航空发动机有限公司",
        },
        {
          xmname: "宁进伟",
          name: '陈海新',
          companyname: "江钨博大硬面材料",
          zccompanyname: "衣之家服饰有限公司",
        },
        {
          xmname: "刘西",
          name: '肖琳',
          companyname: "时代佳宅工程有限公司",
          zccompanyname: "闯峰贸易有限公司",
        },
        {
          xmname: "包天文",
          name: '周桂平',
          companyname: "湖南潭建科技有限公司芦淞分公司",
          zccompanyname: "京水湖实业有限责任公司",
        },
        {
          xmname: "刘保华",
          name: '王玉兰',
          companyname: "浙江新格有色金属有限公司",
          zccompanyname: "元素化工有限公司",
        },
        {
          xmname: "罗建新",
          name: '郑兆阳',
          companyname: "铂金车位房产服务有限公司",
          zccompanyname: "千金养生坊健康品股份有限公司",
        },
        {
          xmname: "何海军",
          name: '陈春敏',
          companyname: "凯峰传媒有限公司",
          zccompanyname: "湖南阁尹汽车销售服务有限公司",
        },
        {
          xmname: "袁许辉",
          name: '王富根',
          companyname: "经世华源房地产开发有限国责任公司",
          zccompanyname: "湖南恒和成暖通设备有限公司",
        },
        {
          xmname: "包曦炜",
          name: '肖民祥',
          companyname: "湖南腾龙大酒店有限公司",
          zccompanyname: "永鼎机电机车配件有限公司",
        },
      ],
      // feat： 待招职位弹框
      isJobType: false,
      // 公司信息
      companyInfo: {},
      activeNames: ['1']
    };
  },
  created () {
    // setInterval(this.scroll, 0)
  },
  filters: {
    timedate (val) {
      if (val) {
        let datatime = new Date(val)
        let Year = datatime.getFullYear() + '年'
        let Month = (datatime.getMonth() + 1 < 10 ? '0' + (datatime.getMonth() + 1) : datatime.getMonth() + 1) + '月'
        let Dated = datatime.getDate() + '日发布'
        let time = Year + Month + Dated
        return time
      }
    },
  },
  mounted () {
    this.getjson();
    if (this.$route.query.search || this.$route.query.isVeteran) {
      this.get = this.$route.query.search;
      this.isVeteran = this.$route.query.isVeteran || ''
      console.log(this.get);
      this.getlist();
    } else {
      this.getlist();
    }

  },
  methods: {
    scroll () {
      this.animate = true;    // 因为在消息向上滚动的时候需要添加css3过渡动画，所以这里需要设置true
      setTimeout(() => {      //  这里直接使用了es6的箭头函数，省去了处理this指向偏移问题，代码也比之前简化了很多
        this.companyname.push(this.companyname[0]);  // 将数组的第一个元素添加到数组的
        this.companyname.shift();               //删除数组的第一个元素
        this.animate = false;  // margin-top 为0 的时候取消过渡动画，实现无缝滚动
      }, 500)
    },
    //   收藏
    getCollection (city) {
      if (!localStorage.getItem('ps_Authorization')) {
        this.$message.error('您还没有登录，请先进行登录');
        return false;
      }
      this.jobId = city.id;
      this.companyId = city.companyId;
      this.userId = localStorage.getItem('ps_userId');
      // this.userId=city.companyId
      let query = new FormData();
      query.append('jobId', this.jobId);
      query.append('companyId', this.companyId);
      query.append('userId', this.userId);
      Collection(query).then(res => {
        if (res.success == true) {
          this.$message.success(`收藏成功`);
          this.getlist()
        } else {
          this.$message.error(`${res.msg}`);
        }
      });
    },
    // 取消收藏
    cancelCollection (city) {
      if (!localStorage.getItem('ps_Authorization')) {
        this.$message.error('您还没有登录，请先进行登录')
        return false
      }
      this.jobId = city.id
      this.companyId = city.companyId
      this.userId = localStorage.getItem("ps_userId")
      // this.userId=city.companyId
      let query = new FormData();
      query.append('jobId', this.jobId)
      query.append('companyId', this.companyId)
      query.append('userId', this.userId)
      console.log(city)
      cancelCollection(query).then((res) => {
        if (res.success == true) {
          this.$message.success(`取消收藏成功`);
          this.getlist()
        } else {
          this.$message.error(`${res.msg}`);
        }
      })
    },
    // 获取职位列表数据
    getlist () {
      let loading = this.$loading({
        lock: true,
        text: 'Loading',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.1)'
      });
      var text;
      if (this.radio1 == '') {
        text = this.radio1;
      } else {
        text = this.radio1;
      }
      let con = [];
      let a = {};
      a.column = 'work_area';
      a.type = 'like';
      a.value = text ? text : null;
      con.push(a);
      let b = {};
      b.column = 'us_company_trade';
      b.type = '';
      b.value = this.str;
      con.push(b);

      let c = {};
      c.column = 'category';
      c.type = 'like';
      c.value = this.ruleForm.region[2];
      con.push(c);

      let d = {};
      d.column = 'work_exp';
      d.type = 'eq';
      d.value = this.ruleForm.region2;
      con.push(d);

      let e = {};
      e.column = 'education';
      e.type = 'eq';
      e.value = this.ruleForm.region3;
      con.push(e);

      let text2;
      if (this.ruleForm.region4 == '') {
        text2 = this.ruleForm.region4;
      } else {
        text2 = JSON.stringify(this.ruleForm.region4);
      }
      let f = {};
      f.column = 'us_company_nature';
      f.type = '';
      f.value = text2;
      con.push(f);

      let g = {};
      g.column = 'nature';
      g.type = 'eq';
      g.value = this.ruleForm.region5;
      con.push(g);

      let text3;
      if (this.ruleForm.region6 == '') {
        text3 = this.ruleForm.region6;
      } else {
        text3 = JSON.stringify(this.ruleForm.region6);
      }
      let h = {};
      h.column = 'allure';
      h.type = 'like';
      h.value = text3;
      con.push(h);

      let i = {};
      i.column = 'company_job_name';
      i.type = '';
      i.value = this.get;
      con.push(i);

      let j = {};
      j.column = 'min_max_wage';
      j.type = '';
      j.value = this.radio3;
      con.push(j);

      let l = {};
      l.column = 'status_in_string';
      l.type = '';
      l.value = '1';
      con.push(l);

      // 特殊职位
      let specialCon = {};
      specialCon.column = 'is_veteran';
      specialCon.type = 'eq';
      specialCon.value = this.isVeteran == "1" ? true : '';
      con.push(specialCon);

      let con2 = [];
      let k = {};
      k.column = this.column;
      k.type = 'desc';
      con2.push(k);

      con.push({ "column": "include", "type": "", "value": "D,CI,F" })

      let query = new FormData();
      query.append('condition', JSON.stringify(con));
      query.append('sort', JSON.stringify(con2));
      query.append('page', this.currentPage);
      list(query).then(res => {
        console.log(res, 'list结果')
        if (res.success) {
          this.options.list = res.data.records || [];
          console.log(this.options.list || [], 'list');
          this.total = res.data.total;
          loading.close()
        } else {
          loading.close()
          this.$message.error(`${res.msg}`)
        }


      });
    },
    // 首先获取上面查询条件的数据
    getjson () {
      industry().then(res => {
        this.options.industry = res.data;
      });
      category().then(res => {
        this.options.category = res.data;
      });
      let parentAreas = JSON.parse(localStorage.getItem("parentAreas"))
      if (parentAreas && parentAreas.length > 0) {
        this.options.area = parentAreas
      } else {
        parentArea().then(res => {
          if (res.success) {
            this.options.area = res.data
            localStorage.setItem("parentAreas", JSON.stringify(res.data))
          }
        });
      }
      // fix: 修复 工作经验、学历要求、公司性质、职位性质、只为标签
      dictName().then(res => {
        if (res.success) {
          this.options.work_exp = res.data.work_exp;
          // this.options.area = res.data.area;
          this.options.education = res.data.education;
          this.options.company_nature = res.data.company_nature;
          this.options.allure = res.data.allure;
          this.options.work_mode = res.data.work_mode;
        }

      })
    },
    handleCheckAllChange (val) {
      this.checkedCities = val ? this.options.list : [];
      this.isIndeterminate = false;
    },
    handleCheckedCitiesChange (value) {
      console.log(value, 'val');
      let checkedCount = value.length;
      this.checkAll = checkedCount === this.options.list.length;
      this.isIndeterminate = checkedCount > 0 && checkedCount < this.options.list.length;
    },
    // 进入职位详情页
    handleclick (city) {
      const { href } = this.$router.resolve({
        path: '/JobHunting/jobdetail',
        // fix 传参 只传递id，不传递对象，这样安全
        query: { id: city.id, category: city.category }
      })
      window.open(href, '_blank')
    },
    // 进入企业详情页
    enterBusinessDetail (city) {
      const { href } = this.$router.resolve({
        path: '/Popularenterprises',
        query: {
          companyId: city.companyId
        }
      })
      window.open(href, '_blank')
    },
    agreeChange (val) {
      this.getlist(val);
    },
    agreeChange2 (val) {
      this.childrenArr = val.childVo;
    },
    aaaaa (item) {
      if (item.id === this.isCurrent) {
        this.istrue = !this.istrue;
      } else {
        this.istrue = true;
        this.isCurrent = item.id;
      }
    },
    // 行业不限
    noTrade () {
      this.str = '';
      this.getlist();
      this.istrue = false;
    },
    handletrade (item) {
      this.str = item;
      this.getlist();
    },
    handlechange (val) {
      this.getlist();
    },
    handlechange2 (val) {
      this.getlist();
    },
    // 清空类别 所有查询条件都清空了
    resetForm (from) {
      this.$refs[from].resetFields();
      this.ruleForm.region = '';
      this.ruleForm.region2 = '';
      this.ruleForm.region3 = '';
      this.ruleForm.region4 = '';
      this.ruleForm.region5 = '';
      this.ruleForm.region6 = '';
      this.radio1 = '';  //区域
      this.radio2 = '';  // 行业
      this.str = '';
      this.istrue = false;
      this.radio3 = '';  // 月薪
      this.isVeteran = ''; // 特殊职位
      this.getlist();
    },
    current_change (currentPage) {
      this.currentPage = currentPage;
      this.getlist();
    },
    create_time () {
      this.column = 'create_time';
      this.currentPage = 1;
      this.getlist();
    },
    max_wage () {
      this.column = 'max_wage';
      this.currentPage = 1;
      this.getlist();
    },
    // 一键申请弹框 选择简历
    deliverSave () {
      if (!localStorage.getItem('ps_Authorization')) {
        this.$message.error('您还没有登录，请先进行登录');
        return false;
      }
      // 查询简历列表【如果有快速投递则直接投递简历，否则显示选择简历的弹框】
      gitInterface().then(res => {
        if (res.success) {
          this.resumelist = res.data;
          let isFlag = false; // 定义一个开关变量
          res.data.map(item => {
            if (item.express) { // 有快速投递
              isFlag = true;
              this.resumeId = item.id; // 获取简历id
            }
          })
          if (isFlag) {
            // 直接申请
            this.getApplyPosition();
          } else {
            // 选择简历的弹框出现
            this.innerVisible = true;
          }
        } else {
          console.log('错误');
        }
      });
    },
    // 直接申请职位[多个]
    getApplyPosition () {
      let idArr = [];
      let that = this;
      that.checkedCities.map(item => {
        idArr.push({
          jobId: item.id, // 职位id
          companyId: item.companyId // 企业id
        })
      })
      let formData = {
        "resumeId": this.resumeId,
        "dataJson": idArr
      }
      deliverSave(formData).then(res => {
        if (res.success) {
          that.$message({
            message: '投递成功',
            type: 'success'
          });
          that.checkedCities = [];
          that.checkAll = false;
          this.$router.push({
            path: '/resumeDeliveredSuccess',
            query: {
              category: this.category
            }
          })

        } else {
          that.$message.error(res.msg);
          that.checkedCities = [];
          that.isIndeterminate = false;
          that.checkAll = false
        }
      });
    },
    // 获取id
    resume (val) {
      this.resumeId = val

    },
    // 关闭弹框
    closeResume () {
      this.resumeValue = ''
      this.resumeId = ''
      this.resumeChecked = false;
      this.checkAll = false
      this.isJobType = false
    },
    // 一键你申请单个
    deliverSave_determine () {
      if (!this.resumeValue) {
        this.$message.error('请选择简历');
        return false;
      }
      let item = this.resume;
      let that = this;
      let idArr = [
        {
          jobId: item.id,
          companyId: item.companyId
        }
      ];
      let formData = {
        "resumeId": this.resumeId,
        "dataJson": idArr
      }
      deliverSave(formData).then(res => {
        if (res.success) {
          this.$message({
            message: '投递成功',
            type: 'success'
          });
          this.innerVisible = false;
          // 如果resumeChecked = true,则调用设置快速投递的接口
          if (this.resumeChecked) {
            //  调用是否默认简历头覅
            this.updateExpress();
          } else {
            // 选中的简历为空
            this.resumeValue = '';
          }
          this.$router.push({
            path: '/resumeDeliveredSuccess',
            query: { category: this.resume.category || '' }
          });

        } else {
          this.$message.error(res.msg);
          // this.innerVisible = false
        }
      });
    },
    // 是否默认设置为此建立为快速投递投递简历
    updateExpress () {
      let obj = {
        express: this.resumeChecked,
        id: this.resumeId
      };
      updateExpress(obj).then(res => {
        if (res.success) {
          // this.innerVisible = false;
          // this.$router.push({
          //   path: '/resumeDeliveredSuccess',
          //   query: { category: this.resume.category || '' }
          // });
          console.log('设置未默认简历成功');
        }
      });
    },
    // 一键申请全部
    allDeliverSaveDialog () {
      if (this.checkedCities.length <= 0) {
        this.$message.error('请选择要申请的职位');
        return false;
      }
      this.isAll = true;
      // 申请全部
      // this.allApply();
      this.deliverSave();
    },
    // 申请全部
    allApply () {
      // 查询简历列表【如果有快速投递则直接投递简历，否则显示选择简历的弹框】
      gitInterface().then(res => {
        if (res.success) {
          this.resumelist = res.data;
          let isFlag = false; // 定义一个开关变量
          res.data.map(item => {
            if (item.express) { // 有快速投递
              isFlag = true;
              this.resumeId = item.id; // 获取简历id
            }
          })
          if (isFlag) {
            // 直接申请
            this.getApplyPosition();
          } else {
            // 选择简历的弹框出现
            this.innerVisible = true;
          }
          // res.data.map(item => {
          //   if (item.express) {
          //     this.resumeValue = item.title;
          //     this.resumeId = item.id
          //     this.resumeChecked = true;
          //   }
          // });
          // this.resumelist = res.data;
          // this.innerVisible = true;
        } else {
          console.log('错误');
        }
      });
    },
    // 一键申请单个
    oneDeliverSaveDialog (val) {
      if (!localStorage.getItem('ps_Authorization')) {
        this.$message.error('您还没有登录，请先进行登录');
        return false;
      }
      // feat: 该岗位为樟树市人才服务代招职位
      this.companyInfo = val
      if (val.jobType == 1) {
        this.isJobType = true
      } else {
        this.isAll = false
        // 查看简历
        gitInterface().then(res => {
          if (res.success) {
            let data = res.data;
            // 简历容器
            this.resumelist = res.data;
            let isFlag = false; // 设置变量开关 如果有默认简历 则为true 没有则为false
            data.map(item => {
              // 如果是快速投递的则直接投递并进入聊天页面，不是快速投递的则弹框显示
              if (item.express) {  // 快速投递
                isFlag = true;
                this.resumeId = item.id; // 获取简历id
              }
            })
            if (isFlag) { // 有设置默认投递，则直接申请，不显示弹框, 如果没有默认设置则点击投递操作的时候就需要求职者选择一份自己的简历投递
              // 立即申请职位
              this.oneApply();
            } else {
              this.innerVisible = true;
            }
          } else {
            this.$message.error(`${res.msg}`)
          }
        })
        if (val) {
          this.resume = val
        }
      }
    },
    // 一键申请单个职位
    oneApply () {
      let idArr = [];
      idArr.push({
        jobId: this.companyInfo.id, // 职位id
        companyId: this.companyInfo.companyId // 公司id
      });
      let formData = {
        "resumeId": this.resumeId,
        "dataJson": idArr
      }
      deliverSave(formData).then(res => {
        if (res.success) {
          this.$message({
            message: '投递成功',
            type: 'success'
          });
          this.$router.push({
            path: '/resumeDeliveredSuccess',
            query: {
              category: this.companyInfo.category
            }
          })
        } else {
          this.$message.error(res.msg);
        }
      });
    },
    changeResume (val) {
      this.resumeId = val
    },
    // 一键申请 全部
    allDeliverSave () {
      // if (!localStorage.getItem('ps_Authorization')) {
      //   this.$message.error('您还没有登录，请先进行登录');
      //   return false;
      // }
      if (!this.resumeValue) {
        this.$message.error('请选择简历');
        return false;
      }
      let that = this;
      let idArr = [];
      that.checkedCities.map(item => {
        idArr.push({
          jobId: item.id,
          companyId: item.companyId
        });
      });
      let formData = {
        "resumeId": this.resumeId,
        "dataJson": idArr
      }
      deliverSave(formData).then(res => {
        if (res.success) {
          that.$message({
            message: '申请成功',
            type: 'success'
          });
          that.idArr = [];
          that.checkedCities = [];
          that.isIndeterminate = false;
          that.checkAll = false
          if (that.resumeChecked) {
            that.updateExpress();
          } else {
            that.resumeValue = '';
          }
          that.$router.push({
            path: '/resumeDeliveredSuccess',
            query: { category: that.resume.category || '' }
          });

        } else {
          that.$message.error(res.msg);
          // that.innerVisible = false
          that.checkedCities = [];
          that.checkAll = false
          that.isIndeterminate = false

        }
      });
    },
    // 退役军人检索
    soldierChange (val) {
      this.getlist();
    }
  },
  beforeCreate () {
    this.$EventBus.$on('getJobByName', msg => {
      this.get = msg;
      this.getlist()
      console.log(this.get, 'get');
    });
  }
};
</script>
<style lang="css" scoped>
.Message {
    /* margin-top: 30px; */
    width: 100%;
}
.Message .main {
    background: #fff;
    width: 1200px;
    margin: 0 auto;
}
.search-card {
    display: flex;
    flex-direction: column;
}
.search-card /deep/.el-card__body {
    padding: 20px 30px;
}

.content {
    width: 100%;
    display: flex;
    margin-top: 20px;
}
.mt10 {
    margin-top: 10px;
}
.mt20 {
    margin-top: 20px;
}
.ul1 {
    list-style: none;
    width: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-around;
}
/* 特殊职位样式  start*/
.specialPosition {
    list-style: none;
    width: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-around;
}
.ul1 li,
.ul2 li,
.specialPosition > li {
    width: 76px;
    text-align: right;
    font-size: 14px;
    color: #555555;
}
.specialPosition .el-radio-group {
    display: inline-block;
    /* margin-left: 20px; */
    margin-left: 16px;
}
.specialPosition .isVeteran {
    margin-left: 20px;
}
/* 特殊职位样式  end*/

.ul2 {
    list-style: none;
    width: 100%;
    height: 60px;
    display: flex;
    justify-content: space-around;
}
.istrue {
    width: 90%;
    height: 100px;
    background: rgba(248, 248, 248, 1);
    margin: 14px auto 14px 8%;
}
.left {
    width: 70%;
}
.jobList {
    display: flex;
    justify-content: space-between;
}
.right {
    width: 30%;
    margin-top: 10px;
    height: 400px;
    background: #fff;
}
.el-radio-group {
    width: 100% !important;
    display: flex;
    justify-content: space-around;
}
.istrue .el-radio-group span:not(:first-child) {
    /* margin-left: 20px; */
}
.li2 {
    /* margin-left: 20px; */
    margin-left: 16px;
    width: 100% !important;
    display: block;
    justify-content: space-around;
}
.el-radio-group /deep/ .el-radio-button__inner {
    border: 0 !important;
    border-radius: 5px !important;
}
.demo-ruleForm {
    width: 100%;
    display: inline-flex !important;
    justify-content: space-between !important;
}
.el-form-item {
    width: 120px;
}
.el-form-item /deep/ .el-form-item__content {
    margin-left: 0 !important;
}
.el-input__inner {
    border: 0 !important;
}
.el-checkbox {
    display: flex;
    padding: 15px;
    width: 95%;
    height: 100px;
    margin-top: 10px;
    background: #fff;
}
.first {
    height: 30px;
}
.first /deep/.el-checkbox__inner {
    margin-top: 8px;
}
.el-checkbox /deep/ .el-checkbox__label {
    width: 97%;
    height: 100%;
}
.el-avatar {
    width: 60px;
    height: 60px;
}
.nodisplay {
    display: inline-block;
}
.nodisplay span {
    display: inline-block;
}
.Message /deep/ .el-select {
    width: 100% !important;
}
.Message /deep/ .el-dialog__body {
    height: 100px;
}
.checkouts /deep/ .el-checkbox {
    height: 20px;
}
.collection {
    margin-right: 30px;
}
.favorite img {
    width: 17px;
    height: 16px;
    vertical-align: baseline;
}
.pagination {
    margin-top: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.el-pagination.is-background /deep/ .btn-next,
.el-pagination.is-background /deep/.btn-prev,
.el-pagination.is-background /deep/.el-pager li {
    background-color: #fff;
}

.el-radio-group /deep/ .el-radio-button__inner {
    border: 0 !important;
    border-radius: 5px !important;
    border-radius: 2px !important;
}
.el-radio-group /deep/ .el-radio-button__orig-radio:checked + .el-radio-button__inner {
    /* color: #1893fc;
    background: rgba(248, 248, 248, 1); */
    box-shadow: -1px 0 0 0 #fff;
}

.el-form-item /deep/ .el-form-item__content {
    margin-left: 0 !important;
}

.el-form-item /deep/ .el-input__inner {
    border: 0 !important;
}
.el-form-item /deep/ input::-webkit-input-placeholder {
    color: #555555;
}
.el-form-item /deep/ input::-moz-input-placeholder {
    color: #555555;
}
.el-form-item /deep/ input::-ms-input-placeholder {
    color: #555555;
}
.positionItem p {
    box-sizing: border-box;
    vertical-align: baseline;
}
.positionItem p span {
    display: inline-block;
    padding-left: 10px;
}
.positionItem p .salary {
    color: red;
    padding-left: 0;
}
.noData {
    width: 98.6%;
    height: 50px;
    line-height: 50px;
    text-align: center;
    background: #ffffff;
}
.jonDz /deep/ .el-dialog__header {
    border-bottom: 1px solid #e5e5e5;
}
.jonDz /deep/ .el-dialog__footer {
    padding: 40px 20px 20px;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

.jobItem {
    margin-bottom: 10px;
}
.carouselcont {
    width: 1200px;
    margin: 0 auto;
    color: #f29500;
    text-align: center;
    font-size: 14px;
    margin-bottom: 10px;
}
.carouselconter {
    display: inline-block;
    width: 350px;
    text-align: left;
}
.carouselleft {
    display: inline-block;
    width: 300px;
    margin-left: 20px;
    float: left;
    text-align: left;
}
.carouselright {
    display: inline-block;
    width: 300px;
    margin-right: 20px;
    text-align: right;
    float: right;
}
#box {
    width: 1200px;
    margin: 0 auto;
    color: red;
    text-align: center;
    margin-bottom: 20px;
    overflow: hidden;
    height: 24px;
    position: relative;
}
.anim {
    transition: all 0.5s;
    translate: 0 0 0 -1px;
}
#con1 li {
    list-style: none;
    line-height: 30px;
    height: 30px;
}
.marquee {
    animation: marquee 40s linear infinite;

    white-space: nowrap;

    position: absolute;
}

.marqueeT {
    animation: marqueeT 40s linear infinite;

    white-space: nowrap;

    position: absolute;
}

@keyframes marquee {
    0% {
        left: 0;
    }

    100% {
        left: -410%;
    }
}

@keyframes marqueeT {
    0% {
        left: 410%;
    }

    100% {
        left: 0;
    }
}
.cityrefreshTime {
    height: 20px;
    font-size: 12px;
    line-height: 14px;
    color: #757575;
    /* margin-left: -185px;
    margin-top: 2px; */
}
</style>